/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2024-01-09 10:30:51
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-01-24 11:56:22
 * @FilePath: \cxl-driving-training\src\apis\column\index.ts
 */
import axios from '../../axios/index'

export interface columnPageInterface {
    current: number
    size: number
    name?: string
}

export const columnList = (params: columnPageInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/column/pageList',
        params
    })
}

export const columnDisable = (disable: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/column/enable',
        data: {
            disable,
            id
        }
    })
}

export interface columnOperation {
    id?: string
    introduction?: string
    location?: number //1.首页
    name?: string
    sort?: number
    type?: number //1.视频；2.图片；3.图文
    displayForm?: number //1轮播；2列表
}

export const columnCreate = (data: columnOperation) => {
    return axios({
        method: 'post',
        url: '/api/system/column/add',
        data
    })
}

export const columnEdit = (data: columnOperation) => {
    return axios({
        method: 'post',
        url: '/api/system/column/edit',
        data
    })
}

export interface columnContentPageInterface {
    current: number
    size: number
    contentTitle?: string
}

export const columnContentList = (params: columnContentPageInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/columnContent/pageList',
        params
    })
}

/**
 * 发布-撤销栏目内容
 * @param publishStatus //	发布状态（0.待发布；1.已发布；2.已撤回）
 * @param id
 * @returns
 */
export const columnContentPublish = (publishStatus: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/columnContent/editPublishStatus',
        data: {
            publishStatus,
            id
        }
    })
}

export interface columnContentOperation {
    columnId?: string
    contentInfo?: string
    contentTag?: number //标签：1.推荐；2.热门；3.必看
    contentTitle?: string
    id?: string
    coverPic: string
}

export const columnContentCreate = (data: columnContentOperation) => {
    return axios({
        method: 'post',
        url: '/api/system/columnContent/add',
        data
    })
}

export const columnContentEdit = (data: columnContentOperation) => {
    return axios({
        method: 'post',
        url: '/api/system/columnContent/edit',
        data
    })
}
